//
// Created by Jisam on 29/09/2024 7:10 PM.
// Solution of  小红的圆移动
//#pragma GCC optimize(3)
#include <bits/stdc++.h>

using namespace std;
#define coutn(x) cout << (x) << "\n"
#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>
#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define code_by_jisam cin.tie(nullptr)->sync_with_stdio(false);
typedef long long i64;
typedef unsigned u32;
typedef unsigned long long u64;
typedef __int128 i128;
int dx[] = {-1, 1, 0, 0, 1, 1, -1, -1,};
int dy[] = {0, 0, -1, 1, 1, -1, -1, 1,};

const double pi = acos(-1);

void solution() {
    int n, k;
    cin >> n >> k;
    double x,y,r;
    vector<double> a;
    for(int i = 0 ; i < n ; i ++){
        cin >> x >> y >> r;
        if(x * x + y * y < r * r){
            a.push_back(pi * r * r *(r - sqrt(x * x + y* y)));
        }else{
            a.push_back(0);
        }
    }
    sort(a.begin(),a.end(),greater<double>());
    double ans = 0;
    for(int i = k ; i < n; i ++){
        ans += a[i];
    }
    cout << fixed << setprecision(12) << ans << endl;
}

int main() {
    code_by_jisam;
    i64 T = 1;
//    cin >> T;
    while (T--) {
        solution();
    }
    return 0;
}